#!/bin/bash

if [ -z $1 ]
then 
    echo "Please enter the parameter -d or -r"
    exit
fi

if [ "-d" == $1 ] || [ "d" == $1 ]
then
    bundle install
    bundle exec jekyll serve
    exit
fi

GIT_REMOTE="git@github.com:saymagic/saymagic.github.io.git"

if [ "-r" == $1 ] || [ "r" == $1 ]
then
    git add -A
    if [ -z $2 ]
    then
        git commit . -m "Auto commit by seploy"
    else
        git commit . -m $2
    fi
    git push $GIT_REMOTE master
fi